package com.niiwoo.civet.trade.service.dubbo.loan;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.dto.request.CreditAuditBackRequestDTO;
import com.niiwoo.civet.trade.dto.request.loan.ConfirmLoanRequestDTO;
import com.niiwoo.civet.trade.dto.response.loan.ConfirmResponseDTO;
import com.niiwoo.civet.trade.service.loan.ConsumeLoanDubboService;
import com.niiwoo.civet.trade.service.local.loan.LoanConfirmService;
import com.niiwoo.civet.trade.service.local.loan.creditaduit.ConsumeLoanCreditAduitService;

@Service(version = "1.0.0")
public class ConsumeLoanDubboServiceImpl implements ConsumeLoanDubboService {

    @Value(value = "${web-http-url}")
    private String webHttpUrl;
	
    public static final String TIANCHENG_AFP_CALLBACK_URL = "%s/tc/%s/%s/callback?functionCode=%s";
    
    public static final String LOAN_QUANTITY_LIMIT_KEY = "loan_quantity_limit";
    
    @Autowired
    private LoanConfirmService loanConfirmService;
    
    @Autowired
    private ConsumeLoanCreditAduitService consumeLoanCreditAduitService;

    @Override
    public ConfirmResponseDTO calculateCost(ConfirmLoanRequestDTO confirmLoanRequestDTO){
        return loanConfirmService.loanConfirm(confirmLoanRequestDTO);
    }
    
	@Override
	public void tianchengCreditAuditCallback(CreditAuditBackRequestDTO creditAuditBackRequestDTO) {
		consumeLoanCreditAduitService.creditAuditCallback(creditAuditBackRequestDTO);
	}
}